﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->

<%
set rs=server.createobject("adodb.recordset") 
call panduan()
exec="select * from [user]" 
rs.open exec,conn,1,3
rs.addnew
rs("user_name") = request("user_name")
rs("user_pass") = request("user_pass")
rs("CompanyName") = request("CompanyName")
rs("Phone") = request("Phone")
rs("Fax") = request("Fax")
rs("Address") = request("Address")
rs("Email") = request("Email")
rs("Jifen") = 0
rs("Status") = true
rs("LvJifen") = 0
rs("IsPassed") = false
rs("DateTime")=now()
rs.update
rs.close
set rs=nothing

Session("username")=request("user_name")
Session.Timeout = 1440
Response.Cookies("username")=request("user_name")
response.write "<script>alert('注册成功!')</script>"
response.write "<script>window.location.href='userinfo.asp'</script>"
response.end

function panduan()
    exec="select * from [user] where user_name='"&request("user_name")&"'" 
	set rs=conn.execute(exec) 
    if not rs.eof then 
        response.Write("<script language=javascript>alert('用户名已存在!');history.go(-1)</script>") 
        response.end 
    end if 
    rs.close()
end function
%>